package leetcode;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2022-01-01 00:43
 **/
public class LeetCode2022 {

    public int[][] construct2DArray(int[] original, int m, int n) {
        if (original.length != m * n) {
            return new int[0][];
        }

        int[][] res = new int[m][n];
        for (int i = 0; i < m * n; ++i) {
            res[i / n][i % n] = original[i];
        }

        return res;
    }

}
